''' fun:
    输入：
        小时
        时薪
    条件：
        40h 内： 正常
        40h 外： 1.5倍

'''
##
# 函数意义是什么  -- 为啥简便：当重复利用的时候 -- 作为黑盒子

def compute_pay_1(Hours, Rate):
   pay = 0
   if Hours > 40:
      pay = (40 * Rate) + ((Hours - 40) * (Rate * 1.5))

      print(f"payment is {pay}")
      print('payment is {}'.format(pay))
   else:
      pay = Hours * Rate
      print(f"payment is {pay}")

   return pay

my_pay = compute_pay_1(41,10)

base_line = 100
total_pay = my_pay + base_line

##
def compute_pay_2(hours,rate):
   return hours * rate


regular_hours = float(input('enter your re hours'))
overtime_hours = float(input('extra hours'))
regular_rate = float(input('enter your rate'))

regular_pay = compute_pay_2(regular_hours, regular_rate)
overtime_pay = compute_pay_2(overtime_hours, regular_rate * 1.5)
total_pay = regular_pay + overtime_pay
print(f"this is your pay: $ {total_pay:.2f}")


## 数字统计
'''
    1. 输出统计的总数
    2. 输出统计的个数
    3. 输出统计的平均数
'''
total = 0
count = 0
avg = 0

while 1:
    test_input = input('请输入数字:')

    if test_input == 'done':
        print(f'total:{total},count:{count},avg:{avg}')
        break

    num = float(test_input)

    total = num + total
    count +=1
    avg = total/count

